Skip to content

[release-4.14] OCPBUGS-50592: Set openshift.io/required-scc: privileged annotation in version pods #1151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

openshift-cherrypick-robot

This is an automated cherry-pick of #1129

/assign openshift-ci-robot

… for `version` pods

Utilize the `openshift.io/required-scc` annotation [1] to pin the required SCC to
`version` pods. This will ensure that any existing custom SCCs in the cluster will
not have an effect on the `version` pods.

The `privileged` default SCC [2] was chosen as the pod accesses and modifies
host `/etc/` files. To do that, a pod must run as root and must also pass SELinux
permission checks. This is currently achieved by the pod running as a privileged
root. For such permission, the `privileged` default SCC is required.

Using the `hostmount-anyuid` default SCC is not sufficient for the existing code
as the pod is not able to pass the SELinux permissions checks.
Additional SELinux, host file system, and/or code changes would be needed.

In the future, we may implement such changes or try to use a local persistent
volume [3] as running the version pod as privileged root is undesirable for
the pod's goal of copying files into another pod.

Some of the other alternatives are modifications to the current architecture
of two separate pods or using a different type of volume.

[1] https://docs.openshift.com/container-platform/4.17/authentication/managing-security-context-constraints.html#security-context-constraints-requiring_configuring-internal-oauth
[2] https://docs.openshift.com/container-platform/4.17/authentication/managing-security-context-constraints.html#default-sccs_configuring-internal-oauth
[3] https://kubernetes.io/docs/concepts/storage/volumes/#local
@openshift-ci-robot
Copy link
Contributor

@openshift-cherrypick-robot: Detected clone of Jira Issue OCPBUGS-46410 with correct target version. Will retitle the PR to link to the clone.
/retitle [release-4.14] OCPBUGS-50592: Set openshift.io/required-scc: privileged annotation in version pods

In response to this:

This is an automated cherry-pick of #1129

/assign openshift-ci-robot

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot changed the title [release-4.14] OCPBUGS-46410: Set openshift.io/required-scc: privileged annotation in version pods [release-4.14] OCPBUGS-50592: Set openshift.io/required-scc: privileged annotation in version pods Feb 11, 2025
@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. labels Feb 11, 2025
@openshift-ci-robot
Copy link
Contributor

@openshift-cherrypick-robot: This pull request references Jira Issue OCPBUGS-50592, which is invalid:

  • expected dependent Jira Issue OCPBUGS-50591 to be in one of the following states: VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA), but it is New instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

This is an automated cherry-pick of #1129

/assign openshift-ci-robot

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Feb 11, 2025
@openshift-ci openshift-ci bot requested review from petr-muller and wking February 11, 2025 17:30
Copy link
Member

@wking wking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/retest-required
/jira refresh

@wking
Copy link
Member

wking commented Apr 21, 2025

/label backport-risk-assessed

@openshift-ci openshift-ci bot added the backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. label Apr 21, 2025
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 21, 2025
Copy link
Contributor

openshift-ci bot commented Apr 21, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: openshift-cherrypick-robot, wking

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 21, 2025
@wking
Copy link
Member

wking commented Apr 21, 2025

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Apr 21, 2025
@openshift-ci-robot
Copy link
Contributor

@wking: This pull request references Jira Issue OCPBUGS-50592, which is valid. The bug has been moved to the POST state.

7 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.14.z) matches configured target version for branch (4.14.z)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
  • release note text is set and does not match the template
  • dependent bug Jira Issue OCPBUGS-50591 is in the state Closed (Done-Errata), which is one of the valid states (VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA))
  • dependent Jira Issue OCPBUGS-50591 targets the "4.15.z" version, which is one of the valid target versions: 4.15.0, 4.15.z
  • bug has dependents

Requesting review from QA contact:
/cc @jiajliu

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested a review from jiajliu April 21, 2025 16:03
Copy link
Contributor

openshift-ci bot commented Apr 21, 2025

@openshift-cherrypick-robot: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@dis016
Copy link

dis016 commented Apr 23, 2025

Step1: Install a fresh cluster which contains the fix

dinesh@Dineshs-MacBook-Pro Downloads % oc get clusterversion 
NAME      VERSION                                                AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.14.0-0-2025-04-23-051234-test-ci-ln-hh329qk-latest   True        False         12m     Cluster version is 4.14.0-0-2025-04-23-051234-test-ci-ln-hh329qk-latest
dinesh@Dineshs-MacBook-Pro Downloads %

Step2: Deploy the following SCC


dinesh@Dineshs-MacBook-Pro Downloads % cat /tmp/scc-hostpath-cnf-cat-1.yaml
---
allowHostDirVolumePlugin: true
allowHostIPC: false
allowHostNetwork: false
allowHostPID: false
allowHostPorts: false
allowPrivilegeEscalation: true
allowPrivilegedContainer: true
allowedCapabilities: null
apiVersion: security.openshift.io/v1
defaultAddCapabilities: null
fsGroup:
  type: RunAsAny
groups: []
kind: SecurityContextConstraints
metadata:
  name: scc-hostpath-cnf-cat-1
priority: null
readOnlyRootFilesystem: false
requiredDropCapabilities:
- KILL
- MKNOD
- SETUID
- SETGID
runAsUser:
  type: MustRunAsNonRoot
seLinuxContext:
  type: MustRunAs
supplementalGroups:
  type: RunAsAny
users: []
volumes:
- configMap
- downwardAPI
- emptyDir
- hostPath
- persistentVolumeClaim
- projected
- secret
dinesh@Dineshs-MacBook-Pro Downloads % 
dinesh@Dineshs-MacBook-Pro Downloads % oc create -f /tmp/scc-hostpath-cnf-cat-1.yaml
securitycontextconstraints.security.openshift.io/scc-hostpath-cnf-cat-1 created
dinesh@Dineshs-MacBook-Pro Downloads %

SCC should get deployed successfully

dinesh@Dineshs-MacBook-Pro Downloads % oc get scc scc-hostpath-cnf-cat-1 
NAME                     PRIV   CAPS         SELINUX     RUNASUSER          FSGROUP    SUPGROUP   PRIORITY     READONLYROOTFS   VOLUMES
scc-hostpath-cnf-cat-1   true   <no value>   MustRunAs   MustRunAsNonRoot   RunAsAny   RunAsAny   <no value>   false            ["configMap","downwardAPI","emptyDir","hostPath","persistentVolumeClaim","projected","secret"]
dinesh@Dineshs-MacBook-Pro Downloads %

Step3: Upgrade to latest nightly

dinesh@Dineshs-MacBook-Pro Downloads % oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:d1f8813a118ddf904a6f7937a4e3605ce82a5704ff105e4f892464072cc4ad1f --force --allow-explicit-upgrade
warning: The requested upgrade image is not one of the available updates. You have used --allow-explicit-upgrade for the update to proceed anyway
warning: --force overrides cluster verification of your supplied release image and waives any update precondition failures.
Requested update to release image registry.ci.openshift.org/ocp/release@sha256:d1f8813a118ddf904a6f7937a4e3605ce82a5704ff105e4f892464072cc4ad1f
dinesh@Dineshs-MacBook-Pro Downloads % 

Upgrade Should be started

dinesh@Dineshs-MacBook-Pro Downloads % oc adm upgrade 
info: An upgrade is in progress. Working towards 4.14.0-0.nightly-2025-04-17-181550: 116 of 860 done (13% complete), waiting on etcd, kube-apiserver

warning: Cannot display available updates:
  Reason: NoChannel
  Message: The update channel has not been configured.

dinesh@Dineshs-MacBook-Pro Downloads %

Step4: make sure no errors with version pod

dinesh@Dineshs-MacBook-Pro Downloads % oc get pod -n openshift-cluster-version
NAME                                        READY   STATUS      RESTARTS   AGE
cluster-version-operator-64b7754f4f-xblmz   1/1     Running     0          54s
version--c8qlx-5w8cd                        0/1     Completed   0          67s
dinesh@Dineshs-MacBook-Pro Downloads % 

Step5: Check upgrade completed successfully after sometime

dinesh@Dineshs-MacBook-Pro Downloads % oc adm upgrade 
Cluster version is 4.14.0-0.nightly-2025-04-17-181550

warning: Cannot display available updates:
  Reason: NoChannel
  Message: The update channel has not been configured.

dinesh@Dineshs-MacBook-Pro Downloads % oc get clusterversion 
NAME      VERSION                              AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.14.0-0.nightly-2025-04-17-181550   True        False         7m53s   Cluster version is 4.14.0-0.nightly-2025-04-17-181550
dinesh@Dineshs-MacBook-Pro Downloads % 

@dis016
Copy link

dis016 commented Apr 23, 2025

/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Apr 23, 2025
@openshift-ci-robot
Copy link
Contributor

@openshift-cherrypick-robot: This pull request references Jira Issue OCPBUGS-50592, which is valid.

7 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.14.z) matches configured target version for branch (4.14.z)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
  • release note text is set and does not match the template
  • dependent bug Jira Issue OCPBUGS-50591 is in the state Closed (Done-Errata), which is one of the valid states (VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA))
  • dependent Jira Issue OCPBUGS-50591 targets the "4.15.z" version, which is one of the valid target versions: 4.15.0, 4.15.z
  • bug has dependents

Requesting review from QA contact:
/cc @dis016

In response to this:

This is an automated cherry-pick of #1129

/assign openshift-ci-robot

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested a review from dis016 April 23, 2025 07:13
@jiajliu
Copy link

jiajliu commented Apr 23, 2025

/label cherry-pick-approved

@openshift-ci openshift-ci bot added the cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. label Apr 23, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit a1bf930 into openshift:release-4.14 Apr 23, 2025
11 checks passed
@openshift-ci-robot
Copy link
Contributor

@openshift-cherrypick-robot: Jira Issue OCPBUGS-50592: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-50592 has been moved to the MODIFIED state.

In response to this:

This is an automated cherry-pick of #1129

/assign openshift-ci-robot

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

Distgit: cluster-version-operator
This PR has been included in build cluster-version-operator-container-v4.14.0-202504230806.p0.ga1bf930.assembly.stream.el8.
All builds following this will include this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants